-- ----------------------------
-- Table structure for message
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[message]') AND type IN ('U'))
    DROP TABLE [dbo].[message]
GO

CREATE TABLE [dbo].[message] (
                                 [id] int  IDENTITY(1,1) NOT NULL,
                                 [user_id] int  NOT NULL,
                                 [title] nvarchar(255) COLLATE Chinese_PRC_CI_AI_WS  NOT NULL,
                                 [content] ntext COLLATE Chinese_PRC_CI_AI_WS  NOT NULL,
                                 [reply_content] ntext COLLATE Chinese_PRC_CI_AI_WS DEFAULT NULL NULL,
                                 [create_date] date  NOT NULL,
                                 [modify_date] date DEFAULT NULL NULL,
                                 [reply_date] date DEFAULT NULL NULL
)
GO

ALTER TABLE [dbo].[message] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Table structure for user
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[user]') AND type IN ('U'))
    DROP TABLE [dbo].[user]
GO

CREATE TABLE [dbo].[user] (
                              [id] int  IDENTITY(1,1) NOT NULL,
                              [username] nvarchar(255) COLLATE Chinese_PRC_CI_AI_WS  NOT NULL,
                              [password] nvarchar(255) COLLATE Chinese_PRC_CI_AI_WS  NOT NULL,
                              [role] tinyint  NOT NULL,
                              [status] tinyint  NOT NULL
)
GO

ALTER TABLE [dbo].[user] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Auto increment value for message
-- ----------------------------
DBCC CHECKIDENT ('[dbo].[message]', RESEED, 1)
GO


-- ----------------------------
-- Primary Key structure for table message
-- ----------------------------
ALTER TABLE [dbo].[message] ADD CONSTRAINT [PK__message__3213E83FB34A9638] PRIMARY KEY CLUSTERED ([id])
    WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
    ON [PRIMARY]
GO


-- ----------------------------
-- Auto increment value for user
-- ----------------------------
DBCC CHECKIDENT ('[dbo].[user]', RESEED, 1)
GO


-- ----------------------------
-- Primary Key structure for table user
-- ----------------------------
ALTER TABLE [dbo].[user] ADD CONSTRAINT [PK__user__3213E83FEB49AE6D] PRIMARY KEY CLUSTERED ([id])
    WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
    ON [PRIMARY]
GO
